
update AD_SysConfig set value = '127.0.0.1:22181' where AD_SysConfig_ID=1000280;
update AD_SysConfig set value = '127.0.0.1' where AD_SysConfig_ID=1000019;
update AD_SysConfig set value = 'noreply@winit.com.cn' where AD_SysConfig_ID=1000021;
update AD_SysConfig set value = 'abc' where  AD_SysConfig_ID=1000162;
update AD_SysConfig set value = '127.0.0.1' where  AD_SysConfig_ID=1000035;
update AD_Sysconfig SET value = '127.0.0.1:22181' WHERE name='dubbo.registry.address';
update AD_Sysconfig SET value = 'Y' WHERE name='NEED_START_SPRING_CONTAINER';
UPDATE AD_SYSCONFIG SET VALUE = '25290' WHERE NAME = 'dubbo.protocol.port';

update AD_SysConfig set value = 'UKLE.CWM.UK.EUR' where NAME = 'OWMS_SERVICE_GATE_GROUP';
update AD_SysConfig set value = 'http://127.0.0.1:20680/service-gate/gate/invoke' where NAME = 'OWMS_SERVICE_GATE_ADDRESS';

UPDATE ad_sysconfig SET VALUE = 'http://127.0.0.1:25380/winit-dep-web/' WHERE name = 'OWMS_DEP_SERVER_ADDRESS';
UPDATE ad_sysconfig SET VALUE = 'http://127.0.0.1:1280/ADInterface/services/ModelADService' WHERE name = 'OWMS_API_SERVER_ADDRESS';

UPDATE wt_scheduler_param SET task_url=REPLACE(task_url,'127.0.0.1:8080','127.0.0.1:25380');
UPDATE wt_scheduler_trigger SET ip = '127.0.0.1',CRON_EXPRESSION = '0/59 * * * * ?';

UPDATE ad_sysconfig SET VALUE = 'http://127.0.0.1:1380/winit-dep-web/messageTransportController/saveRiceiveMessageBatch.json' WHERE  NAME = 'push.message.url';
UPDATE ad_sysconfig SET VALUE = 'http://127.0.0.1:1380/winit-dep-web/messageTransportController/querySendMessageBatch.json' WHERE  NAME = 'pull.message.url';

UPDATE wt_dep_current_batch a SET a.gen_batch = 1,syn_batch=1;
TRUNCATE  TABLE wt_dep_send_msg;
TRUNCATE  TABLE wt_dep_send_msg_receiver;
TRUNCATE  TABLE wt_dep_send_msg_batch;
TRUNCATE  TABLE wt_dep_receive_msg;
TRUNCATE  TABLE wt_dep_receive_msg_batch;
TRUNCATE  TABLE wt_dep_msg_transport_log;
TRUNCATE  TABLE wt_sync_lock;
TRUNCATE TABLE WT_SCHEDULER_LOG;
TRUNCATE TABLE WT_ITEMINFO;



update ad_user set password='888';

delete from m_storage;

insert into m_storage (
  M_PRODUCT_ID, M_LOCATOR_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY,
  QTYONHAND, QTYRESERVED, QTYORDERED, DATELASTINVENTORY, M_ATTRIBUTESETINSTANCE_ID, M_STORAGE_ID,
  ISALLOWPICKING, ADJUSTNUM, FREEZESTORAGENUM)
select pid,lid,cid,org_id,'Y',sysdate,cby,sysdate,uby,
  cnt,0,0,null,0,m_storage_seq.nextval,'N',0,0
from (
  select p.m_product_id pid,l.m_locator_id lid,max(i.ad_client_id) cid,max(i.AD_ORG_ID) org_id,
    max(i.CREATEDBY) cby,max(i.UPDATEDBY) uby, count(1) cnt
  from wt_iteminfo i
    left join m_product p on i.m_product_id=p.m_product_id
    left join m_locator l on i.m_locator_id=l.m_locator_id
  where i.status='FSC' AND l.M_LOCATOR_ID IS NOT null
  group by p.m_product_id,l.m_locator_id
);

DECLARE
cursor c_seq is
select SEQUENCE_NAME||','||last_number,max_value,last_number  from user_sequences
order by SEQUENCE_NAME;
p_sequenceName varchar2(50);
p_sequenceName1 varchar2(50);
p_current_seq_value  varchar2(50);
p_seqNextValue varchar2(50);
p_diff_value number;
p_max_value NUMBER;
p_lastnumber NUMBER;
a varchar2(10);
BEGIN
  open c_seq;
 LOOP
    fetch c_seq into p_sequenceName,p_max_value,p_lastnumber;
    exit when c_seq%notfound;
    p_sequenceName1:=SUBSTR(p_sequenceName,0,INSTR(p_sequenceName,',')-1);
    p_current_seq_value:=SUBSTR(p_sequenceName,INSTR(p_sequenceName,',')+1);
    p_seqNextValue:=to_number(SUBSTR(p_sequenceName,INSTR(p_sequenceName,',')+1));
    IF (p_max_value-p_lastnumber)>= 2000000 THEN
       p_seqNextValue:=p_seqNextValue+1000000;
    ELSIF  ((p_max_value-p_lastnumber) >= 200000 AND (p_max_value-p_lastnumber) < 2000000) THEN
       p_seqNextValue:=p_seqNextValue+100000;
    ELSIF   ((p_max_value-p_lastnumber) >= 50000 AND (p_max_value-p_lastnumber) < 200000) THEN
        p_seqNextValue:=p_seqNextValue+10000;
     ELSIF   ((p_max_value-p_lastnumber) >= 10000 AND (p_max_value-p_lastnumber) < 50000) THEN
        p_seqNextValue:=p_seqNextValue+1000;
    ELSIF   ((p_max_value-p_lastnumber) >= 200 AND (p_max_value-p_lastnumber) < 10000) THEN
         p_seqNextValue:=p_seqNextValue+20;
    ELSIF   ((p_max_value-p_lastnumber) >= 20 AND (p_max_value-p_lastnumber) < 200) THEN
         p_seqNextValue:=p_seqNextValue+2;
    END IF;
    p_diff_value:=to_number(p_seqNextValue)-to_number(p_current_seq_value);
       execute immediate'alter sequence '|| p_sequenceName1|| ' increment by '|| abs(p_diff_value)  ||' nocache';
       execute immediate 'select '||p_sequenceName1||'.nextval from dual' into a;
       execute immediate 'alter sequence '|| p_sequenceName1|| ' increment by 1 cache 20';
  END LOOP;
   exception when others then
    dbms_output.put_line('sqlerrm='||SQLERRM);
END;

/

exit